﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Carts
/// </summary>
public class CartsBLL
{

    //Cart Info
    public int id { get; set; }
    public DateTime add_on { get; set; }
    public string status_name { get; set; }
    public int user_id { get; set; }
    public string name { get; set; }
    public string email { get; set; }
    public string address { get; set; }
    public string note { get; set; }
    public string phone_number { get; set; }
    
    //User Info
    
    public int cash_sum { get; set; }
    
    public int payment { get; set; }
    public int status_id { get; set; }
    

	public CartsBLL()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    // public CartsBLL(int id, DateTime add_on, int status_id, string name, string email, string address, string note, string phone_number, int user_id, int cash_sum, int payment)
    //{
    //    this.id = id;
    //    this.add_on = add_on;
    //    this.status_id = status_id;
    //    this.name = name;
    //    this.email = email;
    //    this.address = address;
    //    this.note = note;
    //    this.phone_number = phone_number;
    //    this.user_id = user_id;
    //    this.cash_sum = cash_sum;
    //    this.payment = payment;
    //}

    //Constructor
    public CartsBLL(int id, DateTime add_on, int status_id, string name, string email, string address, string note, string phone_number, int user_id, int cash_sum, int payment, string status_name)
    {
        this.id = id;
        this.add_on = add_on;
        this.status_id = status_id;
        this.name = name;
        this.email = email;
        this.address = address;
        this.note = note;
        this.phone_number = phone_number;
        this.user_id = user_id;
        this.cash_sum = cash_sum;
        this.payment = payment;
        this.status_name = status_name;
    }

    public CartsBLL(int id, DateTime add_on, string namestt, string name, string Address, string fone, int cashsum)
    {
        this.id = id;
        this.add_on = add_on;
        this.status_name = namestt;
        this.name = name;
        this.address = address;
        this.phone_number = fone;
        this.cash_sum = cash_sum;
    }


    public bool insertToCart(CartsBLL cart)
    {
        return CartsDAL.insertToCart(cart);
    }

    public void insertCartDetail(Cart_itemBLL cart, int cartId)
    {
        CartsDAL.insertCartDetail(cart, cartId);
    }
    public int getMaxCartId()
    {
        return CartsDAL.getMaxCartId();
    }

    //manager
    //Get Cart
    public List<CartsBLL> getCartStt(string status)
    {
        return CartsDAL.getCartStt(status);
    }
    //Get Cart Detail
    public CartsBLL getCartDetail(int cart_id)
    {
        return CartsDAL.getCartDetail(cart_id);
    }

    //Set Status of Cart
    public void setStatusCart(int cart_id, int id_stt)
    {
        CartsDAL.setStatusCart(cart_id, id_stt);
    }
    public int totalSum(DateTime from,DateTime to)
    {
        return CartsDAL.totalSum(from,to);
    }
}